<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>监护大纲-技术要求</title>
    <meta name="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"
    />
    <link
      rel="stylesheet"
      href="../../layuiadmin/layui/css/layui.css"
      media="all"
    />
    <link
      rel="stylesheet"
      href="../../layuiadmin/style/admin.css"
      media="all"
    />
    <link
      rel="stylesheet"
      href="../../layuiadmin/style/style.css"
      media="all"
    />
    <link
      rel="stylesheet"
      href="../../layuiadmin/fonts/iconfont.css"
      media="all"
    />
    <style>
      
    </style>
  </head>
  <body>
    <div class="layui-fluid">
      <div class="timeWrap">
        <div class="time_axis">
          <div class="time_box">
            <div class="time_box_list">
              <ul class="time_horizontal"></ul>
            </div>
          </div>
        </div>
        <img
          src="../../layuiadmin/images/backPage.png"
          class="backPreviousPage"
        />
        <a class="gradeCalculationBtn">
          <img src="../../layuiadmin/images/refreshIcon.png" /><span
            >等级计算</span
          >
        </a>
      </div>
      <form
        id="guardianshipProgramForm"
        class="guardianshipProgramForm layui-form"
        lay-filter="guardianshipProgramForm"
        action=""
      >
        <table class="layui-table">
          <tbody>
            <tr>
              <th class="title">项目类别：</th>
              <td colspan="2">
                <input
                  type="radio"
                  lay-skin="primary"
                  name="projectType"
                  value="1"
                />基坑工程
                <input
                  type="radio"
                  lay-skin="primary"
                  name="projectType"
                  value="2"
                />穿越工程
                <input
                  type="radio"
                  name="projectType"
                  value="3"
                />加卸载、管线、桥梁、桩基及其他类
              </td>
              <th class="title">监护等级：</th>
              <td colspan="2">
                <input type="radio" name="level" value="1" />特级
                <input type="radio" name="level" value="2" />一级
                <input type="radio" name="level" value="3" />二级
                <input type="radio" name="level" value="4" />三级
              </td>
            </tr>
            <tr>
              <th colspan="5">轨道交通结构类型</th>
            </tr>
            <tr>
              <th class="title">线路情况：</th>
              <td colspan="2">
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  name="lineType"
                  lay-skin="primary"
                  value="1"
                />运营
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  name="lineType"
                  lay-skin="primary"
                  value="2"
                />在建
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  name="lineType"
                  lay-skin="primary"
                  value="3"
                />规划
              </td>
              <th class="title">车站：</th>
              <td colspan="2">
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  name="stationFlag"
                  lay-skin="primary"
                  value="1"
                />地上
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  name="stationFlag"
                  lay-skin="primary"
                  value="2"
                />地下
              </td>
            </tr>
            <tr>
              <th class="title">区间：</th>
              <td colspan="2">
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  name="stationArea"
                  lay-skin="primary"
                  value="1"
                />单圆
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  name="stationArea"
                  lay-skin="primary"
                  value="2"
                />双圆
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  name="stationArea"
                  lay-skin="primary"
                  value="3"
                />矩形
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  name="stationArea"
                  lay-skin="primary"
                  value="4"
                />高架
                <input
                  t
                  type="checkbox"
                  lay-filter="allCheckBox"
                  name="stationArea"
                  lay-skin="primary"
                  value="5"
                />地面
              </td>
              <th class="title">覆土深度(m)：</th>
              <td colspan="2">
                <div class="layui-input-inline">
                  <input
                    type="text"
                    name="height"
                    class="layui-input layui-disabled"
                  />
                </div>
              </td>
            </tr>
            <tr>
              <th colspan="5">监测要求</th>
            </tr>
            <tr>
              <th rowspan="3">车站</th>
              <th>垂直位移</th>
              <td>
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="stationCzwy"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="stationCzwy"
                />人工
              </td>
              <th rowspan="3">盾构</th>
              <th>垂直位移</th>
              <td>
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="dgCzwy"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="dgCzwy"
                />人工
              </td>
            </tr>
            <tr>
              <th>结构变形(主体)</th>
              <td>
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="stationMain"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="stationMain"
                />人工
              </td>
              <th>水平位移</th>
              <td>
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="dgSpwy"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="dgSpwy"
                />人工
              </td>
            </tr>
            <tr>
              <th>结构变形(附属)</th>
              <td>
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="stationSub"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="stationSub"
                />人工
              </td>
              <th>收敛变形</th>
              <td>
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="dgSlbx"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="dgSlbx"
                />人工
              </td>
            </tr>
            <tr>
              <th rowspan="2">矩形段</th>
              <th>垂直位移</th>
              <td>
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="jxdCzwy"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="jxdCzwy"
                />人工
              </td>
              <th rowspan="2">地面线</th>
              <th>垂直位移</th>
              <td>
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="dmxCzwy"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="dmxCzwy"
                />人工
              </td>
            </tr>
            <tr>
              <th>水平位移</th>
              <td>
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="jxdSpwy"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="jxdSpwy"
                />人工
              </td>
              <th>水平位移</th>
              <td>
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="dmxSpwy"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="dmxSpwy"
                />人工
              </td>
            </tr>
            <tr>
              <th rowspan="5">高架</th>
              <th>道床沉降</th>
              <td colspan="4">
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="gjDccj"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="gjDccj"
                />人工
              </td>
            </tr>
            <tr>
              <th>立柱沉降</th>
              <td colspan="4">
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="gjLzcj"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="gjLzcj"
                />人工
              </td>
            </tr>
            <tr>
              <th>立柱倾斜</th>
              <td colspan="4">
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="gjLzqx"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="gjLzqx"
                />人工
              </td>
            </tr>
            <tr>
              <th>立柱水平位移</th>
              <td colspan="4">
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="gjLzSpwy"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="gjLzSpwy"
                />人工
              </td>
            </tr>
            <tr>
              <th>土体测斜</th>
              <td colspan="4">
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="1"
                  name="gjTtcx"
                />自动
                <input
                  type="checkbox"
                  lay-filter="allCheckBox"
                  lay-skin="primary"
                  value="2"
                  name="gjTtcx"
                />人工
              </td>
            </tr>
            <tr>
              <th>其他监护技术要求</th>
              <td colspan="5">
                <div class="itemMargin">
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="soilMonitor"
                  />深层土体沉降监测
                </div>
                <div class="itemMargin">
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="thirdpartyMonitor"
                  />第三方复测
                </div>
                <div class="itemMargin">
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="remoteMonitor"
                  />远程监控
                </div>
                <div class="itemMargin">
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="fastenMonitor"
                  />加固抽检
                </div>
                <div class="itemMargin">
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="rushFlag"
                  />签订抢单协议
                </div>
                <div class="itemMargin">
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="laserSweepFlag"
                  />三维激光扫描&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp扫描次数
                  <div class="layui-input-inline">
                    <input
                      type="text"
                      name="laserSweepNum"
                      class="layui-input layui-disabled"
                      lay-filter="allInput"
                      disabled
                    />
                  </div>
                </div>
                <div class="itemMargin">
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="videoMonitor"
                  />视频监控
                </div>
                <div class="itemMargin">
                  技术咨询和复核验算(
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="pileCheck"
                  />桩基&nbsp&nbsp/&nbsp&nbsp
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="ditchCheck"
                  />基坑&nbsp&nbsp/&nbsp&nbsp
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="acrossCheck"
                  />穿越)
                </div>
                <div class="itemMargin">
                  场地标高测绘(
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="greenMeasure"
                  />绿化道路项目&nbsp&nbsp测量数量
                  <div class="layui-input-inline">
                    <input
                      type="text"
                      name="greenMeasureNum"
                      class="layui-input"
                      lay-filter="allInput"
                    />
                  </div>
                  m2/&nbsp&nbsp<input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="ditchMeasure"
                  />基坑项目&nbsp&nbsp测量数量
                  <div class="layui-input-inline">
                    <input
                      type="text"
                      name="ditchMeasureNum"
                      class="layui-input"
                      lay-filter="allInput"
                    />
                  </div>
                  m2)
                </div>
                <div class="itemMargin">
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="sidelineFlag"
                  />边线复核测量&nbsp&nbsp(<input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="sidelineActFlag"
                  />实测放样&nbsp&nbsp测量数量
                  <div class="layui-input-inline">
                    <input
                      type="text"
                      name="sidelineActNum"
                      class="layui-input"
                      lay-filter="allInput"
                    />
                  </div>
                  m/&nbsp&nbsp<input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="sidelineDataFlag"
                  />利用资料放样&nbsp&nbsp测量数量
                  <div class="layui-input-inline">
                    <input
                      type="text"
                      name="sidelineDataNum"
                      class="layui-input"
                      lay-filter="allInput"
                    />
                  </div>
                  m)
                </div>
                <div class="itemMargin">
                  <div class="layui-input-inline">
                    <input
                      type="checkbox"
                      lay-filter="allCheckBox"
                      lay-skin="primary"
                      name="simpleFlag"
                    />简易处理
                  </div>
                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="monitorFlag"
                  />是否需要监测&nbsp&nbsp<input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    name="entrustFlag"
                  />是否自行委托

                  <input
                    type="checkbox"
                    lay-filter="allCheckBox"
                    lay-skin="primary"
                    checked
                  />委托单位
                  <select
                    name="entrustUnit"
                    id="unitList"
                    lay-filter="unitListFilter"
                  ></select>
                </div>
              </td>
            </tr>
            <tr>
              <th>移交资料</th>
              <td colspan="5">
                <div class="itemMargin">
                  <textarea
                    name="transfers_data"
                    value="1、承接项目监护监测技术要"
                    placeholder="请输入"
                    class="layui-textarea maxWidth"
                    lay-filter="allInput"
                  ></textarea>
                </div>
              </td>
            </tr>
            <tr>
              <th>备注</th>
              <td colspan="5">
                <textarea
                  name="note"
                  placeholder="备注"
                  class="layui-textarea maxWidth"
                  lay-filter="allInput"
                ></textarea>
              </td>
            </tr>
            <tr>
              <th>报价明细表</th>
              <td colspan="5">
                <div class="quotationDetails">
                  <button type="button" class="layui-btn generateQuotation">
                    <i class="iconfont icon-caidan1"></i>
                    生成报价单
                  </button>
                  <button type="button" class="layui-btn uploadQuotation">
                    <i class="iconfont icon-shangchuan"></i>
                    上传报价单
                  </button>
                  <button type="button" class="layui-btn viewQuotation">
                    <i class="iconfont icon-chakan2"></i>
                    查看报价单
                  </button>
                </div>
              </td>
            </tr>
            <tr>
              <td colspan="6" style="text-align: center">
                <button
                  type="button"
                  class="layui-btn synchronization"
                  lay-submit
                  lay-filter="synchronization"
                >
                  同步
                </button>
              </td>
            </tr>
          </tbody>
        </table>
      </form>
    </div>
    <script type="text/html" id="viewQuotationHtml">
      <div class="viewQuotationHIframe"></div>
    </script>
    <script type="text/html" id="generateQuotationHtml">
      <div>
        <div class="quotationBtn">
          <button type="button" class="layui-btn quotationDown">
            <i class="iconfont icon-xiazai"></i>
            下载
          </button>
          <button type="button" class="layui-btn returnQuotation">
            <i class="iconfont icon-fanhui"></i>
            退回监护大纲
          </button>
        </div>
        <div class="previewXlsxIframe"></div>
      </div>
    </script>
    <script type="text/html" id="quotationUploadHtml">
      <div class="fileUploadDrag">
        <div class="layui-upload-drag" id="additionFileUpload">
          <i class="layui-icon"></i>
          <p>点击上传，或将文件拖拽到此处</p>
          <div class="layui-hide" id="uploadDemoVieww">
            <hr />
            <div class="fileUploadName"></div>
          </div>
        </div>
        <div class="additionInformationDelete"></div>
        <button class="layui-btn layui-btn-xs addfileUploadButton">上传</button>
        <div class="PopupBotmBtn">
          <div>
            <button
              type="button"
              class="layui-btn projectTypeBtn cancelBtn"
              lay-submit=""
              lay-filter="additionInformationCancel"
              id="additionInformationCancel"
            >
              取消
            </button>
          </div>
          <div>
            <button
              type="button"
              class="layui-btn projectTypeBtn"
              lay-submit=""
              id="sureBtn"
            >
              确定
            </button>
          </div>
        </div>
      </div>
    </script>
    <div id="returnComments" style="display: none">
      <form class="layui-form" lay-filter="calendarForm" class="layui-form">
        <div class="layui-form-item">
          <textarea placeholder="" class="layui-textarea" id="commentsTxt">
工程信息概况文档不符合规范模板要求,请修改后重新提交。</textarea
          >
        </div>
        <div class="layui-form-item">
          <div class="changeFileReturn">
            请选择退回文件:<input
              lay-skin="primary"
              type="checkbox"
              id="c_all"
              name="type"
              lay-filter="c_all"
              value="checkall"
            />
          </div>
        </div>
        <div class="layui-form-item">
          <div class="enclosureListPop"></div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">审核人:</label>
            <div class="layui-input-inline">
              <input
                type="text"
                name="name"
                autocomplete="off"
                class="layui-input"
                id="projectReviewer"
              />
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">联系方式:</label>
            <div class="layui-input-inline">
              <input
                type="tel"
                name="phone"
                autocomplete="off"
                class="layui-input"
                value="xxxxx"
              />
            </div>
          </div>
        </div>
        <div class="layui-form-item meetingScheduleBtn">
          <button class="layui-btn" type="button">取消</button>
          <button
            class="layui-btn"
            type="button"
            lay-filter="returnFormSubmit"
            lay-submit
          >
            确定
          </button>
        </div>
      </form>
    </div>
    <script src="../../layuiadmin/modules/const_config.js"></script>
    <script src="../../layuiadmin/modules/jTools.js"></script>
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script>
      layui
        .config({
          base: "../../layuiadmin/", //静态资源所在路径
        })
        .extend({
          index: "lib/index", //主入口模块
        })
        .use(
          ["index", "contlist", "table", "upload", "element", "layer"],
          function () {
            var table = layui.table,
              $ = layui.$,
              upload = layui.upload,
              element = layui.element,
              layer = layui.layer;
            form = layui.form;
            window.allCheckBox = false;
            var guardianshipNo = layui.data("uuid").key;
            var guardianshipNno = layui.data("no").key;
            var id = "";
            /**
             * returnColor
             **/
            function returnColor(param) {
              if (!param) return "green";
              switch (param * 1) {
                case 3:
                  return "blue";
                case 4:
                  return "blue";
                case 5:
                  return "red";
                case 6:
                  return "green";
                default:
                  return "green";
              }
            }
            $.ajax({
              url: base_url + "/outlineProjects/" + guardianshipNo,
              headers: {
                Accept: "application/json; charset=utf-8",
                Authorization: layui.sessionData("userToken").key,
              },
              async: false,
              type: "GET",
              success: function (data) {
                $(".synchronization").hide();
                if (data.code == 200) {
                  if (data.hasOwnProperty("data") == true) {
                    var datas = data.data.dates.reverse();
                    var html = "";
                    for (var i = 0; i < datas.length; i++) {
                      if (i === datas.length - 1) {
                        // 时间轴默认选中
                        html += `
                                  <li class="time_horizontal_part" data-id="${
                                    datas[i].date
                                  }" data-status="curr">
                                      <b class="active activeSty" style="background-color:${returnColor(
                                        datas[i].ackMsg
                                      )}"></b>
                                      ${datas[i].date}<br/>
                                      ${datas[i].msg}<br/>
                                  </li>`;
                      } else {
                        // 时间轴其他
                        html += `
                                  <li class="time_horizontal_part" data-id="${
                                    datas[i].date
                                  }"  data-status="prev">
                                      <b classs="activeSty" style="background-color:${returnColor(
                                        datas[i].ackMsg
                                      )}"></b>
                                      ${datas[i].date}<br/>
                                      ${datas[i].msg}<br/>
                                  </li>`;
                      }
                      $(".time_horizontal").html(html);
                    }
                    // ackMsg
                    // 3   处理中   显示  同步 蓝色
                    // 4 已发送 不显示按钮  蓝色
                    // 5 技术要求表被退回待处理  技术要求表被退回待处理  红色
                    // 6 技术要求表被修改待确认 不显示按钮  绿色
                    var data = data.data.data;
                    dataInitFunS(data);

                    // 时间轴点击
                    $(".time_horizontal_part").on("click", function () {
                      var dateTime = $(this).attr("data-id");
                      var status = $(this).attr("data-status");
                      $(this).children("b").addClass("active");
                      $(this)
                        .siblings("li")
                        .children("b")
                        .removeClass("active");
                      dataInitFun(dateTime, status);
                    });
                  }
                }
              },
            });
            $(".time_horizontal").scrollLeft(
              $(".time_horizontal")[0].scrollWidth
            );
            // 委托单位: 渲染下拉框数据
            function renderSelect() {
              return new Promise((resolve) => {
                $.ajax({
                  type: "GET",
                  async: true, //异步执行
                  url: base_url + "/monitorSuppliers",
                  headers: {
                    Accept: "application/json; charset=utf-8",
                    Authorization: layui.sessionData("userToken").key,
                  },
                  // contentType: "application/json; charset=UTF-8",
                  // dataType: "json",
                  // data: JSON.stringify(params),
                  success: function (data) {
                    if (data.code == 200) {
                      var data = data.data;
                      console.log();
                      $("#unitList").empty();
                      $("#unitList").append(
                        "<option value='0'>---选择记录---</option>"
                      );
                      data.forEach((item) => {
                        $("#unitList").append(new Option(item.name, item.no));
                      });
                      form.render("select");
                      resolve("");
                    } else {
                      layer.msg(data.message, { icon: 5 });
                    }
                  },
                });
              });
            }

            // 点击调接口
            function dataInitFun(dateTime, status) {
              $.ajax({
                url:
                  base_url +
                  "/outlineProjects/" +
                  guardianshipNo +
                  "/" +
                  dateTime,
                headers: {
                  Accept: "application/json; charset=utf-8",
                  Authorization: layui.sessionData("userToken").key,
                },
                async: false,
                type: "GET",
                success: function (data) {
                  var data = data.data;
                  dataInitFunS(data, status);
                },
              });
            }
            // 数据渲染
            function dataInitFunS(data, status) {
              if (status == "prev") {
                $("input").attr("disabled", "disabled");
                $(".synchronization").hide();
                $(".generateQuotation").hide();
                $(".uploadQuotation").hide();
                $(".viewQuotation").hide();
              } else {
                $("input").removeAttr("disabled", "");
                $(".synchronization").show();
                $(".generateQuotation").show();
                $(".uploadQuotation").show();
                $(".viewQuotation").show();
                $(".generateQuotation").on("click", function () {
                  $.ajax({
                    url:
                      base_url +
                      "/outlineProjects/generate/priceList/" +
                      guardianshipNo,
                    headers: {
                      Accept: "application/json; charset=utf-8",
                      Authorization: layui.sessionData("userToken").key,
                    },
                    async: false,
                    type: "GET",
                    success: function (data) {
                      if (data.code == 200) {
                        layer.open({
                          title: '<i class="fa fa-plus"></i>&nbsp;监护报价清单',
                          type: 1,
                          fix: false,
                          skin: "layui-layer-rim",
                          area: ["70%", "90%"],
                          content: $("#generateQuotationHtml").html(),
                          success: function () {
                            var Iframe =
                              '<iframe id="Iframe" width="100%" height="800px"></iframe>';
                            $(".previewXlsxIframe").html(Iframe);
                            $("#Iframe").attr(
                              "src",
                              "../../layuiadmin/web/viewer.html?file=" +
                                base_url +
                                "/outlineProjects/preview/priceList/1/" +
                                data.data
                            );
                            $(".quotationDown").on("click", function () {
                              window.location.href =
                                base_url +
                                "/outlineProjects/download/priceList/" +
                                data.data;
                            });
                            var category = "",
                              personNumber = "";
                            $(".returnQuotation").on("click", function () {
                              layer.open({
                                type: 1,
                                skin: "demo-class",
                                area: ["500", "400"],
                                shadeClose: true,
                                content: $("#returnComments"),
                                title: ["退回意见"],
                                success: function (layero, index) {
                                  $.ajax({
                                    type: "post",
                                    async: true, //异步执行
                                    url:
                                      base_url + "/report/getProgramInfoByUuid",
                                    headers: {
                                      Accept: "application/json; charset=utf-8",
                                      Authorization:
                                        layui.sessionData("userToken").key,
                                    },
                                    contentType: "application/json",
                                    data: JSON.stringify({
                                      uuid: guardianshipNo,
                                    }),
                                    success: function (data) {
                                      var data = data.data.project;
                                      category = data.category;
                                      personNumber = data.managerNumber;
                                      if (data.files.length == 0) {
                                        $(".enclosureList").html(" ");
                                      } else {
                                        FILE_ID = data.files[1].fileEmcId;
                                        FILE_IDD = data.files[0].fileEmcId;
                                        var str = "",
                                          strr = "",
                                          strrr = "",
                                          item = "";
                                        data.files.forEach((item, index) => {
                                          if (
                                            item.extName === "pdf" ||
                                            item.extName === "PDF"
                                          ) {
                                            item = ` <div class="layui-form-item"><input  lay-skin="primary" type="checkbox" name="enclosureItem" lay-filter="c_one" class="c_one" value="${item.filetype}"/><img src='../../layuiadmin/images/pdf.png'/>${item.fileName}</div>`;
                                          } else if (item.extName === "docx") {
                                            item = ` <div class="layui-form-item"><input  lay-skin="primary" type="checkbox" name="enclosureItem" lay-filter="c_one" class="c_one" value="${item.filetype}"/><img src='../../layuiadmin/images/word.png'/>${item.fileName}</div>`;
                                          } else {
                                            item = ` <div class="layui-form-item"><input lay-skin="primary" type="checkbox" name="enclosureItem" lay-filter="c_one" class="c_one" value="${item.filetype}"/><img src='../../layuiadmin/images/enclosure.png'/>${item.fileName}</div>`;
                                          }
                                          $(".enclosureListPop").append(item);
                                          form.render();
                                        });
                                      }
                                    },
                                  });
                                  $("#projectReviewer").val(
                                    layui.sessionData("userName").key
                                  );
                                  form.on(
                                    "submit(returnFormSubmit)",
                                    function (d) {
                                      var arr = new Array();
                                      $(
                                        "input:checkbox[name='enclosureItem']:checked"
                                      ).each(function (i) {
                                        arr[i] = $(this).val();
                                      });
                                      //退回意见内容
                                      var commentsTxt = $("#commentsTxt").val();
                                      $.ajax({
                                        type: "post",
                                        async: true,
                                        url: "http://10.1.14.200/MMS/api/plotting/checkTechnicalFile",
                                        contentType: "application/json",
                                        headers: {
                                          Accept:
                                            "application/json; charset=utf-8",
                                        },
                                        data: JSON.stringify({
                                          no: guardianshipNno,
                                          type: category,
                                          opinion: commentsTxt,
                                          fileTypeList: arr,
                                          personNumber: personNumber,
                                        }),
                                        success: function (data) {
                                          //当报审反馈成功
                                          if (data.code == 200) {
                                            //调用技审方法
                                            $.ajax({
                                              type: "post",
                                              async: true,
                                              url:
                                                base_url +
                                                "/Technical/processFlow",
                                              headers: {
                                                Accept:
                                                  "application/json; charset=utf-8",
                                                Authorization:
                                                  layui.sessionData("userToken")
                                                    .key,
                                              },
                                              contentType: "application/json",
                                              data: JSON.stringify({
                                                no: no,
                                                opinion: commentsTxt,
                                                type: category,
                                                uuid: guardianshipNo,
                                              }),
                                              success: function (data) {
                                                if (data.code == 200) {
                                                  layer.msg(data.message, {
                                                    icon: 6,
                                                  });
                                                } else {
                                                  layer.msg(data.message, {
                                                    icon: 2,
                                                  });
                                                }
                                              },
                                            });
                                          } else {
                                            //报审的反馈失败
                                            layer.msg(data.message, {
                                              icon: 2,
                                            });
                                          }
                                        },
                                      });
                                    }
                                  );
                                },
                              });
                            });
                          },
                        });
                      }
                    },
                  });
                });
                $(".uploadQuotation").on("click", function () {
                  var otherLayer = layer.open({
                    title: '<i class="fa fa-plus"></i>&nbsp;报价单上传',
                    type: 1,
                    fix: false,
                    skin: "layui-layer-rim",
                    area: ["527px", "395px"],
                    content: $("#quotationUploadHtml").html(),
                    success: function () {
                      $("#sureBtn").on("click", function () {
                        if ($(".additionInformationDelete").html() == "") {
                          return layer.msg(
                            "请选择文件",
                            { time: 500 },
                            function () {}
                          );
                        }
                      });
                      $("#additionInformationCancel").on("click", function () {
                        layer.closeAll();
                      });
                      $(".addfileUploadButton").on("click", function () {
                        if ($(".additionInformationDelete").html() == "") {
                          return layer.msg(
                            "请先选择文件",
                            { time: 500 },
                            function () {}
                          );
                        }
                      });
                      var loadIndex = "";
                      var additionFileUploadRender = upload.render({
                        elem: "#additionFileUpload",
                        elemList: $(".additionInformationDelete"), //列表元素对象
                        accept: "file",
                        multiple: true,
                        auto: false,
                        url:
                          base_url +
                          "/outlineProjects/upload/priceList/" +
                          guardianshipNo,
                        bindAction: ".addfileUploadButton",
                        headers: {
                          Accept: "application/json; charset=utf-8",
                          Authorization: layui.sessionData("userToken").key,
                        },
                        before: function (obj) {
                          if ($(".additionInformationDelete").html() == "") {
                            return layer.msg(
                              "请先选择文件",
                              { time: 500 },
                              function () {}
                            );
                          }
                          loadIndex = layer.load(2);
                        },
                        choose: function (obj) {
                          var that = this;
                          var files = (this.files = obj.pushFile()); //将每次选择的文件追加到文件队列 //读取本地文件
                          obj.preview(function (index, file, result) {
                            let html = "";
                            html = $(
                              [
                                '<div id="upload-' +
                                  index +
                                  '" style="margin:5px 0">',
                                "<span>" + file.name + "</span>",
                                '<span style="margin-left:10px">',
                                '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>',
                                "</span>",
                                "</div>",
                              ].join("")
                            );
                            //删除
                            html.find(".demo-delete").on("click", function () {
                              delete files[index]; //删除对应的文件
                              html.remove();
                              additionFileUploadRender.config.elem.next()[0].value =
                                "";
                            });
                            that.elemList.append(html);
                          });
                        },
                        done: function (res, index, upload) {
                          var that = this;
                          if (res.code == 200) {
                            $("#sureBtn").on("click", function () {
                              layer.closeAll();
                            });
                            var html = that.elemList.find(
                              "div#upload-" + index
                            );
                            html.parent().children().html(""); //清空操作
                            delete this.files[index]; //删除文件队列已经上传成功的文件
                          }
                          layer.msg(
                            res.message,
                            { time: 10000 },
                            function () {}
                          );
                          layer.close(loadIndex);
                        },
                        error: function () {
                          layer.close(loadIndex);
                        },
                      });
                    },
                  });
                });
                $(".viewQuotation").on("click", function () {
                  layer.open({
                    title: '<i class="fa fa-plus"></i>&nbsp;监护报价清单',
                    type: 1,
                    fix: false,
                    skin: "layui-layer-rim",
                    area: ["70%", "90%"],
                    content: $("#viewQuotationHtml").html(),
                    success: function () {
                      var Iframe =
                        '<iframe id="Iframe" width="100%" height="800px"></iframe>';
                      $(".viewQuotationHIframe").html(Iframe);
                      $("#Iframe").attr(
                        "src",
                        "../../layuiadmin/web/viewer.html?file=" +
                          base_url +
                          "/outlineProjects/preview/priceList/2/" +
                          guardianshipNo
                      );
                    },
                  });
                });

                if (
                  data.hasOwnProperty("ackMsg") == false ||
                  data.ackMsg == ""
                ) {
                  $(".synchronization").hide();
                } else if (data.ackMsg == "5") {
                  $(".synchronization").html("技术要求表重新生成");
                  $(".synchronization").css("background", "#e79e4c");
                } else if (data.ackMsg == "3") {
                  $(".synchronization").html("同步");
                } else if (data.ackMsg == "6") {
                  $(".synchronization").hide();
                  // $(".synchronization").html("技术要求表被修改待确认");
                  // $(".synchronization").css("background", "#e79e4c");
                }
              }
              $('[name="height"]').attr("disabled", "disabled");
              // 单独禁用
              id = data.id;
              var projectType = data.projectType;
              var projectTypeCheckBox = $("input[name='projectType']");
              projectTypeCheckBox.attr("disabled", "disabled");
              checkBoxFun(projectTypeCheckBox, projectType);

              var level = data.level;
              var levelCheckBox = $("input[name='level']");
              levelCheckBox.attr("disabled", "disabled");
              checkBoxFun(levelCheckBox, level);

              lineTypeArray = data.lineType.split(",");
              var lineTypeCheckBox = $("input[name='lineType']");
              lineTypeCheckBox.attr("disabled", "disabled");
              checkBoxFunction(lineTypeCheckBox, lineTypeArray);

              stationFlagArray = data.stationFlag.split(",");
              var stationFlagCheckBox = $("input[name='stationFlag']");
              stationFlagCheckBox.attr("disabled", "disabled");
              checkBoxFunction(stationFlagCheckBox, stationFlagArray);

              stationAreaArray = data.stationArea.split(",");
              var stationAreaCheckBox = $("input[name='stationArea']");
              stationAreaCheckBox.attr("disabled", "disabled");
              checkBoxFunction(stationAreaCheckBox, stationAreaArray);

              function checkBoxFunction(checkboxData, checkBoxArray) {
                for (var i = 0; i < checkBoxArray.length; i++) {
                  for (var j = 0; j < checkboxData.length; j++) {
                    var checkbox = $(checkboxData[j]);
                    if (checkbox.val() == checkBoxArray[i]) {
                      checkbox.attr("checked", "checked");
                      break;
                    }
                  }
                }
              }

              form.render("checkbox");
              var stationCzwy = data.stationCzwy;
              var stationCzwyCheckBox = $("input[name='stationCzwy']");
              checkBoxFun(stationCzwyCheckBox, stationCzwy);

              var stationMain = data.stationMain;
              var stationMainCheckBox = $("input[name='stationMain']");
              checkBoxFun(stationMainCheckBox, stationMain);

              var stationSub = data.stationSub;
              var stationSubCheckBox = $("input[name='stationSub']");
              checkBoxFun(stationSubCheckBox, stationSub);

              var dgCzwy = data.dgCzwy;
              var dgCzwyCheckBox = $("input[name='dgCzwy']");
              checkBoxFun(dgCzwyCheckBox, dgCzwy);

              var dgSpwy = data.dgSpwy;
              var dgSpwyCheckBox = $("input[name='dgSpwy']");
              checkBoxFun(dgSpwyCheckBox, dgSpwy);

              var dgSlbx = data.dgSlbx;
              var dgSlbxCheckBox = $("input[name='dgSlbx']");
              checkBoxFun(dgSlbxCheckBox, dgSlbx);

              var jxdCzwy = data.jxdCzwy;
              var jxdCzwyCheckBox = $("input[name='jxdCzwy']");
              checkBoxFun(jxdCzwyCheckBox, jxdCzwy);

              var dmxCzwy = data.dmxCzwy;
              var dmxCzwyCheckBox = $("input[name='dmxCzwy']");
              checkBoxFun(dmxCzwyCheckBox, dmxCzwy);

              var jxdSpwy = data.jxdSpwy;
              var jxdSpwyCheckBox = $("input[name='jxdSpwy']");
              checkBoxFun(jxdSpwyCheckBox, jxdSpwy);

              var dmxSpwy = data.dmxSpwy;
              var dmxSpwyCheckBox = $("input[name='dmxSpwy']");
              checkBoxFun(dmxSpwyCheckBox, dmxSpwy);

              var gjDccj = data.gjDccj;
              var gjDccjCheckBox = $("input[name='gjDccj']");
              checkBoxFun(gjDccjCheckBox, gjDccj);

              var gjLzcj = data.gjLzcj;
              var gjLzcjCheckBox = $("input[name='gjLzcj']");
              checkBoxFun(gjLzcjCheckBox, gjLzcj);

              var gjLzqx = data.gjLzqx;
              var gjLzqxCheckBox = $("input[name='gjLzqx']");
              checkBoxFun(gjLzqxCheckBox, gjLzqx);

              var gjLzSpwy = data.gjLzSpwy;
              var gjLzSpwyCheckBox = $("input[name='gjLzSpwy']");
              checkBoxFun(gjLzSpwyCheckBox, gjLzSpwy);

              var gjTtcx = data.gjTtcx;
              var gjTtcxCheckBox = $("input[name='gjTtcx']");
              checkBoxFun(gjTtcxCheckBox, gjTtcx);

              function checkBoxFun(checkBoxArray, data) {
                checkBoxArray.each(function (index, item) {
                  if (item.value == data) {
                    item.checked = true;
                  } else if (data === 3) {
                    item.checked = true;
                  }
                });
              }
              renderSelect().then((res) => {
                form.val("guardianshipProgramForm", {
                  height: data.height,
                  soilMonitor: data.soilMonitor === "false" ? false : true,
                  thirdpartyMonitor:
                    data.thirdpartyMonitor === "false" ? false : true,
                  remoteMonitor: data.remoteMonitor === "false" ? false : true,
                  sidelineFlag: data.sidelineFlag === "false" ? false : true,
                  ditchMeasure: data.ditchMeasure === "false" ? false : true,
                  greenMeasure: data.greenMeasure === "false" ? false : true,
                  pileCheck: data.pileCheck === "false" ? false : true,
                  ditchCheck: data.ditchCheck === "false" ? false : true,
                  acrossCheck: data.acrossCheck === "false" ? false : true,
                  note: data.note,
                  ditchMeasureNum: data.ditchMeasureNum,
                  greenMeasureNum: data.greenMeasureNum,
                  laserSweepNum: data.laserSweepNum,
                  sidelineActNum: data.sidelineActNum,
                  sidelineDataNum: data.sidelineDataNum,
                  fastenMonitor: data.fastenMonitor === "false" ? false : true,
                  rushFlag: data.rushFlag === "false" ? false : true,
                  laserSweepFlag:
                    data.laserSweepFlag === "false" ? false : true,
                  sidelineDataFlag:
                    data.sidelineDataFlag === "false" ? false : true,
                  sidelineActFlag:
                    data.sidelineActFlag === "false" ? false : true,
                  videoMonitor: data.videoMonitor === "false" ? false : true,
                  entrustFlag: data.entrustFlag === "false" ? false : true,
                  monitorFlag: data.monitorFlag === "false" ? false : true,
                  simpleFlag: data.simpleFlag === "false" ? false : true,
                  // transfers_data: data.transfers_data || "测试数据",
                  entrustUnit: data.entrustUnit,
                });
              });
            }

            if ($(".synchronization").html() == "同步") {
              form.on("submit(synchronization)", function (data) {
                var field = data.field; //获取提交的字段
                field.projectId = guardianshipNo;
                field.id = id;
                var stationCzwyL = $("input[name='stationCzwy']:checked");
                field.stationCzwy = checkBoxName(
                  stationCzwyL,
                  field.stationCzwy
                );

                var dgCzwyL = $("input[name='dgCzwy']:checked");
                field.dgCzwy = checkBoxName(dgCzwyL, field.dgCzwy);

                var stationMainL = $("input[name='stationMain']:checked");
                field.stationMain = checkBoxName(
                  stationMainL,
                  field.stationMain
                );

                var dgSpwyL = $("input[name='dgSpwy']:checked");
                field.dgSpwy = checkBoxName(dgSpwyL, field.dgSpwy);

                var stationSubL = $("input[name='stationSub']:checked");
                field.stationSub = checkBoxName(stationSubL, field.stationSub);

                var dgSlbxL = $("input[name='dgSlbx']:checked");
                field.dgSlbx = checkBoxName(dgSlbxL, field.dgSlbx);

                var jxdCzwyL = $("input[name='jxdCzwy']:checked");
                field.jxdCzwy = checkBoxName(jxdCzwyL, field.jxdCzwy);

                var dmxCzwyL = $("input[name='dmxCzwy']:checked");
                field.dmxCzwy = checkBoxName(dmxCzwyL, field.dmxCzwy);

                var jxdSpwyL = $("input[name='jxdSpwy']:checked");
                field.jxdSpwy = checkBoxName(jxdSpwyL, field.jxdSpwy);

                var dmxSpwyL = $("input[name='dmxSpwy']:checked");
                field.dmxSpwy = checkBoxName(dmxSpwyL, field.dmxSpwy);

                var gjDccjL = $("input[name='gjDccj']:checked");
                field.gjDccj = checkBoxName(gjDccjL, field.gjDccj);

                var gjLzcjL = $("input[name='dmxCzwy']:checked");
                field.gjLzcj = checkBoxName(gjLzcjL, field.gjLzcj);

                var gjLzqxL = $("input[name='gjLzqx']:checked");
                field.gjLzqx = checkBoxName(gjLzqxL, field.gjLzqx);

                var gjLzSpwyL = $("input[name='gjLzSpwy']:checked");
                field.gjLzSpwy = checkBoxName(gjLzSpwyL, field.gjLzSpwy);

                var gjTtcxL = $("input[name='gjTtcx']:checked");
                field.gjTtcx = checkBoxName(gjTtcxL, field.gjTtcx);
                function checkBoxName(name, fieldName) {
                  if (name.length == 0) {
                    fieldName = "0";
                  } else if (name.length == 2) {
                    fieldName = "3";
                  } else {
                    name.each(function (i) {
                      fieldName = $(this).val();
                    });
                  }
                  return fieldName;
                }
                field.acrossCheck = fieldFun(field.acrossCheck);
                field.fastenMonitor = fieldFun(field.fastenMonitor);
                field.rushFlag = fieldFun(field.rushFlag);
                field.laserSweepFlag = fieldFun(field.laserSweepFlag);
                field.videoMonitor = fieldFun(field.videoMonitor);
                field.entrustFlag = fieldFun(field.entrustFlag);
                field.monitorFlag = fieldFun(field.monitorFlag);
                field.greenMeasure = fieldFun(field.greenMeasure);
                field.ditchMeasure = fieldFun(field.ditchMeasure);
                field.sidelineFlag = fieldFun(field.sidelineFlag);
                field.sidelineDataFlag = fieldFun(field.sidelineDataFlag);
                field.sidelineActFlag = fieldFun(field.sidelineActFlag);
                field.thirdpartyMonitor = fieldFun(field.thirdpartyMonitor);
                field.ditchCheck = fieldFun(field.ditchCheck);
                field.pileCheck = fieldFun(field.pileCheck);
                field.remoteMonitor = fieldFun(field.remoteMonitor);
                field.soilMonitor = fieldFun(field.soilMonitor);
                field.simpleFlag = fieldFun(field.simpleFlag);
                function fieldFun(fieldData) {
                  if (fieldData == "on") {
                    fieldData = true;
                  } else {
                    fieldData = false;
                  }
                  return fieldData;
                }

                if (window.allCheckBox) {
                  autoSave(field);
                } else {
                  // layer.alert("功能暂未开发!");
                  // return;
                  syncSave(field);
                }
                window.allCheckBox = false;
                return false;
              });
            } else if ($(".synchronization").html() == "技术要求表重新生成") {
              $(".synchronization").attr(
                "lay-href",
                "./pages/gradeDetermination.html"
              );
            }

            $(".backPreviousPage").on("click", function () {
              $(this).attr("lay-href", "./pages/technicalReview.html");
            });
            $(".gradeCalculationBtn").on("click", function () {
              $(this).attr("lay-href", "./pages/gradeDetermination.html");
            });
            // 复选框点击事件
            form.on("checkbox(allCheckBox)", function (data) {
              // 复选框选择是，手动调下同步按钮
              window.allCheckBox = true;
              $('[lay-filter="synchronization"]').click();
            });
            // 下拉框选择事件
            form.on("select(unitListFilter)", function (data) {
              window.allCheckBox = true;
              $('[lay-filter="synchronization"]').click();
            });
            // 输入框事件
            $('[lay-filter="allInput"]').on("input", function () {
              // console.log($(this).val());
              console.log(111);
              window.allCheckBox = true;
              $('[lay-filter="synchronization"]').click();
            });
            // 自动同步数据接口
            function autoSave(params) {
              // 更新监护大纲数据:自动保存
              $.ajax({
                type: "POST",
                async: true, //异步执行
                url: base_url + "/outlineProjects/update",
                headers: {
                  Accept: "application/json; charset=utf-8",
                  Authorization: layui.sessionData("userToken").key,
                },
                contentType: "application/json; charset=UTF-8",
                dataType: "json",
                data: JSON.stringify(params),
                success: function (data) {
                  if (data.code == 200) {
                    layer.msg(data.message, { icon: 6 });
                  } else {
                    layer.msg(data.message, { icon: 5 });
                  }
                },
              });
            }

            // 同步调接口
            function syncSave(params) {
              $.ajax({
                type: "get",
                async: true, //异步执行
                url: base_url + "/outlineProjects/push/" + guardianshipNo,
                headers: {
                  Accept: "application/json; charset=utf-8",
                  Authorization: layui.sessionData("userToken").key,
                },
                contentType: "application/json; charset=UTF-8",
                dataType: "json",
                data: params,
                success: function (data) {
                  if (data.code == 200) {
                    layer.msg(data.message, { icon: 6 });
                  } else {
                    layer.msg(data.message, { icon: 5 });
                  }
                },
              });
            }
          }
        );
    </script>
  </body>
</html>
